module SemanticText
  class Heading
  	attr_reader :text, :depth

    def self.parse(line)
      line =~ /(!+)(.*)/
      Heading.new($2,$1.size)
    end

  	def initialize(aTitle, depth)
  		@text = aTitle
  		@depth = depth
  	end
  	
  	#export as html
    def export_html
      "\n<h#{@depth}>#{ CGI.escapeHTML(@text)}</h#{@depth}>"
    end
    
  end
end